<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            position: relative;
            height: 100px;
            background-color: orange;
        }
        b {
            position: absolute;
            display: block;
            top: 0;
            right: 0;
            width: 35px;
            height: 35px;
            text-align: center;
            line-height: 35px;
            cursor: pointer;
        }
    </style>
</head>

<body>
    <div class="box">
        <b>X</b>
    </div>
    <script>
        var box = document.querySelector('.box') 
        var b = document.querySelector('b')
        b.onclick = function() {
            box.style.display = 'none'
        } 
    </script>
</body>

</html>